import React from 'react'
import { useNavigate } from 'react-router-dom'

function App() {
  const navigate = useNavigate()
  const loginToHome = () => {
    navigate('/', { replace: true })
  }

  const loginToAbout = () => {
    navigate('/about?id=1001&name=mafei', { replace: true })
  }

  const loginToLike = () => {
    navigate('/like/1001', { replace: true })
  }
  return (
    <div>
      <div>Login</div>
      <button onClick={loginToHome}>登录，跳转到home</button>
      <button onClick={loginToAbout}>登录，跳转到about</button>
      <button onClick={loginToLike}>登录，跳转到like</button>
    </div>
  )
}

export default App
